package com.letv.android.client.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

/**
 * 全屏播放器seekbar
 * 
 * @author zhuqiao
 *
 */
public class LetvSeekBarFullScreen extends LetvSeekBar {
    private WatchingFocusRelativeLayout watchingFocusRelativeLayout;

    public LetvSeekBarFullScreen(Context context) {
        this(context, null);
    }

    public LetvSeekBarFullScreen(Context context, AttributeSet attrs) {
        this(context, attrs, android.R.attr.seekBarStyle);
    }

    public LetvSeekBarFullScreen(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected void init() {
        super.init();
        mSeekBar.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                switch (motionEvent.getAction()) {
                    case MotionEvent.ACTION_UP:
                    case MotionEvent.ACTION_DOWN:
                    case MotionEvent.ACTION_MOVE:
                        if (mSeekBarTouchListener != null) {
                            mSeekBarTouchListener.onSeekBarTouch(motionEvent);
                        }
                        break;
                }
                if (watchingFocusRelativeLayout != null) {
                    watchingFocusRelativeLayout.onSeekTouch(motionEvent);
                }
                return false;
            }
        });
    }

    public void setWatchingFocusRelativeLayout(WatchingFocusRelativeLayout watchingFocusRelativeLayout) {
        this.watchingFocusRelativeLayout = watchingFocusRelativeLayout;
    }
}
